package org.com.dao;

import java.util.List;

import org.com.dao.impl.RegistDaoImpl;
import org.com.domain.User;

import com.ibatis.sqlmap.client.SqlMapClient;


public class RegistDao extends SqlConnTemplate implements RegistDaoImpl {
	
	private List<User> userList;
	private User user;
	
	@Override
	public SqlMapClient getSqlMap() {
		return super.getSqlMap();
	}
	
	/* regist User */
	public void registUser(User user) throws Exception {
		getSqlMap().insert("registUser", user);
		
	}

	/* get all UserList */
	@SuppressWarnings("unchecked")
	public List<User> getUserList() throws Exception {
		userList = getSqlMap().queryForList("getUserList");
		return userList;
	}
	
	/* get one User */
	public User getUser(String name) throws Exception {
		user = (User) getSqlMap().queryForObject("getUser", name);
		return user;
			
	}
	
	/* update user (my info) */
	public void updateUser(User user) throws Exception {
		getSqlMap().update("updateUser", user);
	}

	/*delete user*/
	public void deleteUser(Integer num) throws Exception {
		getSqlMap().delete("deleteUser", num);

	}

	
	
}
